package com.zcf.shiro.config;

import com.alibaba.druid.filter.Filter;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.wall.WallConfig;
import com.alibaba.druid.wall.WallFilter;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author zhaochaofeng
 */
@Configuration
public class JzwjgDsc {

    @Bean(name = "jzwjgDataSource")
    @ConfigurationProperties(prefix="jzwjg.datasource")
    public DruidDataSource jzwjgDataSource() throws SQLException {
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setDriverClassName("oracle.jdbc.driver.OracleDriver");
        List list = new ArrayList<Filter>();
        dataSource.setProxyFilters(list);
        dataSource.setFilters("wall");
        return dataSource;
    }

}
